package cn.alex.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.alex.bean.po.User;
import cn.alex.mapper.UserMapper;

@Service
public class UserService {

	@Autowired
	private UserMapper userMapper;

	public List<User> queryAll() {
		return userMapper.selectList(null);
	}

	public User queryUserById(Integer id) {
		return userMapper.selectById(id);
	}

	@Transactional
	public void insert(User user) {
		userMapper.insert(user);
	}

	@Transactional
	public void update(User user) {
		userMapper.updateById(user);
	}

	@Transactional
	public void delete(Integer id) {
		userMapper.deleteById(id);
	}
}
